﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="index.aspx.cs" Inherits="active_yuanxiao_index" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>2013年游龙惊凤赏花灯，元宵寻宝乐逍遥</title>
<meta name="keywords" content="9158多人视频">
<meta name="description" content="9158多人视频聊天室是一款免费的ktv视频聊天软件，有同城聊天室，交友聊天室等房间，网上卡拉OK，展现优美歌喉就来9158多人视频聊天室吧">
<meta name="robots" content="index, follow" />
<meta name="googlebot" content="index, follow" />
<script type="text/javascript" src="common/js/jquery.js"></script>
<script type="text/javascript" src="common/js/paomadeng.js"></script>
<link href="common/css/style.css" rel="stylesheet" type="text/css" />
</head>
<!--[if lte IE 6]>
<script src="common/js/DD_belatedPNG_0.0.8a.js" type="text/javascript"></script>
<script type="text/javascript">DD_belatedPNG.fix('.nu1');</script>
<![endif]-->
<body>
<div class="wrap">		
	<div class="main">
		<div class="top"></div>
		<div class="con">
			<div class="c_left">
				<div class="mc clearfix">
					<ul>
						<li><div class="p1" id="tb0"><h4>经验20</h4></div></li>
						<li><div class="p2" id="tb1"><h4>拼图1</h4></div></li>
						<li><div class="p3" id="tb2"><h4>拼图2</h4></div></li>
						<li><div class="p4" id="tb3"><h4>拼图3</h4></div></li>
						<li><div class="p5" id="tb4"><h4>拼图4</h4></div></li>
						<li class="cj"><input type="button" class="btna" id="btn" onclick="lottery();"/></li>
						<li><div class="p6" id="tb5"><h4>拼图5</h4></div></li>
						<li><div class="p7" id="tb6"><h4>拼图6</h4></div></li>
						<li><div class="p8" id="tb7"><h4>拼图7</h4></div></li>
						<li><div class="p9" id="tb8"><h4>拼图8</h4></div></li>
						<li><div class="p10" id="tb9"><h4>拼图9</h4></div></li>							
					</ul>
				</div>
				<div class="info"><span class="fc01">你目前有<b class="f13" ><span id="times">0</span>次</b>寻宝机会</span><br />可用道具数：<span id="num">0</span></div>
			</div>
			<div class="c_rig">
				
				<dl>			
					<dd>1、送出<b class="f13">100个</b>活动道具即可获得一次寻宝机会；</dd>
					<dd><img src="common/images/11.gif" /></dd>
					<dd>2、搜集到完整一套“元宵献宝图”即可领取<b class="f13">20W</b>奖励；</dd>
					<dd>3、活动结束后“元宵寻宝榜”的前三名用户分别获得<b class="fc01 f14">200万/100万/50万</b>奖励，其余上榜用户皆获得<b class="f13">20万</b>奖励；</dd>
				</dl>
			</div> 
		</div>
		<div class="botcon">
			<div class="pingcon">
				<div class="pingtu">
					<ul id="myimg">
						<li class="pu1b"></li>
						<li class="pu2b"></li>
						<li class="pu3b"></li>
						<li class="pu4b"></li>
						<li class="pu5b"></li>
						<li class="pu6b"></li>
						<li class="pu7b"></li>
						<li class="pu8b"></li>
						<li class="pu9b"></li>
					</ul>
				</div>
				<div class="pingw"><input name="" type="button" class="pingbtn2" id="btn2" onclick="win();"/></div>
			</div>			
			<div class="tph">
				<ul id="rank">
					<li class="mb5" style="color:#7d1500;"><span class="nu0 fb">排名</span><span class="name fb">用户昵称</span><span class="val fb">集齐次数</span></li>					
				</ul>
			</div>			
		</div>	
	</div>
</div>	
<div class="foot clearfix">浙 B2-20060279 浙江省第二届“十佳”文明办网示范单位 Copyright &copy;2006-2013 版权所有 9158.com<br /> 
客服：400-8839158</div>
</body>
<script type="text/javascript">

var iswait=0;
function wait(){
    iswait=1;
    $("#btn").attr("className","btnb");
    $("#btn2").attr("className","pingbtn2");
}
function start(){
    iswait=0;
    $("#btn").attr("className","btna");
}

function user()
{
 $.ajax({      type:"POST",	  url:"handler.ashx",	  data:"action=user",	  success: function(data){	    if(data==null||data.length<1){return;}	    	    $("#num").html(data[0]["num"]);	    $("#times").html(parseInt(data[0]["num"]/100));        show(data[0]["MyNo"]);        if(data[0]["MyNo"]=="111111111")            $("#btn2").attr("className","pingbtn1");        	  }	});
}

function show(str)
{  
    var arr=new Array();
     arr=str.split('');
     $(arr).each(function(index,item){
        if(item=="1")
            $("#myimg").find("li")[index].className="pu"+(index+1);
        else{
            $("#myimg").find("li")[index].className="pu"+(index+1)+"b";
            }
     });
}

function lottery()
{ 
  if(iswait)
        return;
    wait(); $.ajax({      type:"POST",	  url:"handler.ashx",	  data:"action=lottery",	  beforeSend : function(x) {
			x.setRequestHeader("Content-Type","application/json; charset=GB2312");		
		},		  success: function(data){            if(data==null||data[0]==null){alert("抱歉，出错了，请重试!");return;}            var ret=data[0];            var r=ret["ret"];            if(r==-1)                alert("抱歉，您的道具数不够！");            else if(r==-3)                alert("您已经找到美女，请重新开始游戏！");            else if(r==-4)                alert("抱歉，活动已结束！");            else if(r>=0){                $("#btn").attr("className","btnc");                paomadeng.StartGame(r+1);                }            else                alert("抱歉，出错了，请重试！");           if(r<0)            start();     			  },	  complete: function(XMLHttpRequest, textStatus){	        },	  error:function(e,f)	  {	    alert("抱歉，出错了，请重试");start();	  }	});
}

function result(num){
    if(num==1)
        alert("恭喜您获得经验20点！");
    else
        alert("恭喜您获得拼图"+(num-1));
    start();
    user();
}
function win(){
      if(iswait)
        return;
      wait();     $.ajax({          type:"POST",	      url:"handler.ashx",	      data:"action=win",	      beforeSend : function(x) {
			    x.setRequestHeader("Content-Type","application/json; charset=GB2312");		
		    },		      success: function(data){                if(data==null||data[0]==null){alert("抱歉，出错了，请重试!");return;}                var ret=data[0];                var r=ret["ret"];                if(r==-1)                    alert("抱歉，您的拼图不够！");                else if(r==-3)                    alert("您已经找到美女，请重新开始游戏！");                else if(r==-4)                    alert("抱歉，活动已结束！");                else if(r>=0){                    alert("恭喜您获得金币"+r);                    user();                    }                else                    alert("抱歉，出错了，请重试！");                    			      },	      complete: function(XMLHttpRequest, textStatus){	        start();          },	      error:function(e,f)	      {	        alert("抱歉，出错了，请重试");	      }	    });
}

function rank()
{
 $.ajax({      type:"Get",	  url:"handler.ashx",	  data:"action=rank",	  success: function(data){	    if(data==null||data.length<1){return;}	    var str="";	    for(var i=0;i<data.length;i++)	    {  	             str+='<li><span class="nu1">'+(i+1)+'</span><span class="name">'+data[i]["myname"]+'</span><span class="val">'+data[i]["num"]+'</span></li>';        }        $("#rank").append(str);	  }	});
}
user();
rank();
</script>
</html>
